﻿/*
 * HCC Robotica, Workshop Robot programmeren met C# 
 * Oefening : wo_02	LED knipperen, methode: als hartslag in de processing loop 
 * Naam     : Hinnie
 * Versie   : september 2011
 */

using System;
using System.Threading;

using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

using GHIElectronics.NETMF.FEZ;

namespace wo_02
{
    public class wo_02
    {
        public static void Main()
        {
            OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, false);

            bool ledState = false;
            const int loopTime = 5;
            const int flashTime = 200 / loopTime;
            const int reportTime = 1000 / loopTime;
            int reportCount = 0;
            int flashCount = 0;
            int seqNr = 0;
            while (true)
            {
                if (reportCount++ >= reportTime)
                {
                    reportCount = 0;
                    seqNr++;                // seqNr  = seqNr + 1;   // seqNr += 1;
                    Debug.Print("Amazing " + seqNr.ToString());
                }
                if (flashCount++ >= flashTime)
                {
                    flashCount = 0;
                    ledState = !ledState;    // toggle LED state
                    led.Write(ledState);     // Blink board LED
                }
                Thread.Sleep(loopTime);
            }
        }
    }
}
